namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0027 : DbMigration
    {
        public override void Up()
        {
            // DropForeignKey("dbo.rule_approve_type", "rule_approve_group_seq", "dbo.rule_approve_group");
            DropIndex("dbo.rule_approve_type", new[] { "rule_approve_group_seq" });
            DropTable("dbo.rule_absence");
            DropTable("dbo.rule_approve");
            DropTable("dbo.rule_approve_custom_button");
            DropTable("dbo.rule_approve_group");
            DropTable("dbo.rule_approve_type");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.rule_approve_type",
                c => new
                    {
                        rule_approve_type_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_seq = c.Int(),
                        rule_approve_type_name = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_type_seq);
            
            CreateTable(
                "dbo.rule_approve_group",
                c => new
                    {
                        rule_approve_group_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_name = c.String(),
                        ref_to_database = c.String(),
                        ref_to_table_name = c.String(),
                        ref_column_seq_name = c.String(),
                        ref_action_name = c.String(),
                        ref_controller_name = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_group_seq);
            
            CreateTable(
                "dbo.rule_approve_custom_button",
                c => new
                    {
                        rule_approve_custom_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_seq = c.Int(nullable: false),
                        rule_approve_custom_name = c.String(),
                        navigate_url = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_custom_seq);
            
            CreateTable(
                "dbo.rule_approve",
                c => new
                    {
                        rule_approve_seq = c.Int(nullable: false, identity: true),
                        rule_approve_type_seq = c.Int(),
                        step = c.Int(),
                        approver_type = c.String(),
                        approver_seq = c.Int(),
                        action = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_seq);
            
            CreateTable(
                "dbo.rule_absence",
                c => new
                    {
                        rule_absence_seq = c.Int(nullable: false, identity: true),
                        emp_type_seq = c.Int(nullable: false),
                        absence_type_seq = c.Int(nullable: false),
                        send_before = c.Int(),
                        include_nwd = c.String(),
                        day_limit = c.Decimal(precision: 18, scale: 2),
                        day_limit_full_salary = c.Decimal(precision: 18, scale: 2),
                        day_limit_half_salary = c.Decimal(precision: 18, scale: 2),
                        time_limit = c.Decimal(precision: 18, scale: 2),
                        day_per_time_limit = c.Decimal(precision: 18, scale: 2),
                        rule_approve_type_seq = c.Int(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_absence_seq);
            
            CreateIndex("dbo.rule_approve_type", "rule_approve_group_seq");
            AddForeignKey("dbo.rule_approve_type", "rule_approve_group_seq", "dbo.rule_approve_group", "rule_approve_group_seq");
        }
    }
}
